package com.enhe.gck.exception;

import com.enhe.gck.communal.ResultCode;
import com.enhe.gck.enums.WeighingResultEnum;
import lombok.Getter;
import lombok.Setter;

/**
 * @Author 褚波
 * @Date 2024-04-19 11:10:27
 * @Description 自定义异常
 */
@Getter
@Setter
public class WeighException extends RuntimeException {

    /**
     * 错误码
     */
    protected Integer errorCode;
    /**
     * 称重结果码
     */
    protected Integer weighResultCode;
    /**
     * 错误信息
     */
    protected String errorMsg;

    public WeighException() {
        super();
    }

    public WeighException(WeighingResultEnum weighingResultEnum) {
        this(ResultCode.ZERO.getCode(), weighingResultEnum.getCode(), weighingResultEnum.getName());
    }
    public WeighException(WeighingResultEnum weighingResultEnum, String message) {
        this(ResultCode.ZERO.getCode(), weighingResultEnum.getCode(), message);
    }

    public WeighException(Integer errorCode, Integer weighResultCode, String errorMsg) {
        super(errorMsg);
        this.errorCode = errorCode;
        this.weighResultCode = weighResultCode;
        this.errorMsg = errorMsg;
    }

}
